{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2025-02-27 13:27:09.594 Python[95480:4103498] +[IMKClient subclass]: chose IMKClient_Modern\n",
      "2025-02-27 13:27:09.594 Python[95480:4103498] +[IMKInputSession subclass]: chose IMKInputSession_Modern\n"
     ]
    },
    {
     "ename": "SystemExit",
     "evalue": "0",
     "output_type": "error",
     "traceback": [
      "An exception has occurred, use %tb to see the full traceback.\n",
      "\u001b[0;31mSystemExit\u001b[0m\u001b[0;31m:\u001b[0m 0\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/fox/proj/backtester/.venv/lib/python3.13/site-packages/IPython/core/interactiveshell.py:3587: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n",
      "  warn(\"To exit: use 'exit', 'quit', or Ctrl-D.\", stacklevel=1)\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout\n",
    "from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    app = QApplication(sys.argv)\n",
    "    window = QWidget()\n",
    "    window.setWindowTitle(\"PyQt with Matplotlib\")\n",
    "\n",
    "    # 创建 Matplotlib 图形\n",
    "    fig = plt.Figure()\n",
    "    ax = fig.add_subplot(111)\n",
    "    x = np.linspace(0, 10, 100)\n",
    "    y = np.sin(x)\n",
    "    ax.plot(x, y)\n",
    "\n",
    "    # 创建 FigureCanvas 对象\n",
    "    canvas = FigureCanvas(fig)\n",
    "\n",
    "    layout = QVBoxLayout()\n",
    "    layout.addWidget(canvas)\n",
    "    window.setLayout(layout)\n",
    "\n",
    "    window.show()\n",
    "    sys.exit(app.exec_())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
